﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;

namespace SXFramWork.Core
{
    /// <summary>
    /// 数据库上下文
    /// </summary>
    public interface IDbContext
    {
        IUnitOfWork GetCurrentUow();
        string GetConnectionStr();
        /// <summary>
        /// 创建新的连接
        /// </summary>
        /// <param name="transaction">事务</param>
        /// <returns></returns>
        IDbConnection NewConnection(IDbTransaction transaction = null);

        /// <summary>
        /// 创建新的工作单元
        /// </summary>
        /// <returns></returns>
        IUnitOfWork NewUnitOfWork();

        /// <summary>
        /// 创建新的工作单元
        /// </summary>
        /// <returns></returns>
        IUnitOfWork NewUnitOfWork(IsolationLevel isolationLevel);
    }
}
